import sys
sys.path.append('/Users/a123/Documents/Yingxi/241206/AC_Python/SDS6108L')
from env import *
from lib_sds import *
import datetime
getts = lambda fmt: datetime.datetime.now().strftime(fmt)
tsname = lambda: getts("%Y%m%d%H%M%S")
lib = LibVisa()
print(lib.list_device())
print(lib.connect('USB0::0x0699::0x0409::C022832::INSTR'))
lib.write('SAVe:IMAGe:FILEFormat PNG')
lib.write('SAVe:IMAGe tmp.png')
lib.write('HARDCopy STARt')
data = lib.read_raw()
with open(tsname()+'.png','wb') as fw:
  fw.write(data)
